package info.techgeek.labs.patterns.serviceLocatorPattern;

/*public class ServiceLocatorVerifier implements WaitingAlarm
{
  private VerifiedServiceLocator serviceLocator;
  private AlarmClock myAlarmClock;
  private long serverVerifierPeriod;
  private ServiceVerifiable appSpecificServiceVerifiable;
  public ServiceLocatorVerifier(
    int _serverVerifierPeriod_Minutes,  
    ServiceVerifiable _appSpecificServiceVerifiable)
  {
    serviceLocator = VerifiedServiceLocator.getInstance();
    // Convert minutes to milliseconds
    serverVerifierPeriod = _serverVerifierPeriod_Minutes * 60 * 1000;
    appSpecificServiceVerifiable = _appSpecificServiceVerifiable;
    this.startAlarmClock();
  }
  private void startAlarmClock()
  {
    // Create the alarmClock
    myAlarmClock = new AlarmClock(this, serverVerifierPeriod);
    // Start the alarmClock
    myAlarmClock.start();
  }
  *//**
  *  This method is called when the alarmClock rings.
  *  So if the alarm is ringing, it is time to check
  *  the cached services.
  *//*
  public void alarmRinging()
  {
    try
    {
      appSpecificServiceVerifiable.checkServices();
    }
    catch( Exception exc)
    {
      serviceLocator.cleanCache();
      appSpecificServiceVerifiable.followError(exc);
    }
  }
  protected void finalize() throws Throwable
  {
    // Turn off my alarm clock
    myAlarmClock.interrupt();
  }
}*/

